package com.cindata.dictionary

class BuildingTypeDict extends DataDict
{

    static Residence()
    {
        BuildingTypeDict.findByName('住宅')
    }

    static NonResidential()
    {
        BuildingTypeDict.findByName('非住宅')
    }

    /**
     * 初始化房屋用途
     * @return
     */
    static initData()
    {
        def buildingTypeDict

        buildingTypeDict = BuildingTypeDict.findByName('住宅')
        if (!buildingTypeDict)
        {
            buildingTypeDict = new BuildingTypeDict()
        }
        buildingTypeDict.properties = [name: '住宅', code: 'Residential']
        buildingTypeDict.save()

        buildingTypeDict = BuildingTypeDict.findByName('商业')
        if (!buildingTypeDict)
        {
            buildingTypeDict = new BuildingTypeDict()
        }
        buildingTypeDict.properties = [name: '商业', code: 'Business']
        buildingTypeDict.save()

        buildingTypeDict = BuildingTypeDict.findByName('办公')
        if (!buildingTypeDict)
        {
            buildingTypeDict = new BuildingTypeDict()
        }
        buildingTypeDict.properties = [name: '办公', code: 'Office']
        buildingTypeDict.save()

        buildingTypeDict = BuildingTypeDict.findByName('工业')
        if (!buildingTypeDict)
        {
            buildingTypeDict = new BuildingTypeDict()
        }
        buildingTypeDict.properties = [name: '工业', code: 'Industry']
        buildingTypeDict.save()

        buildingTypeDict = BuildingTypeDict.findByName('非住宅')
        if (buildingTypeDict)
        {
            buildingTypeDict.delete()
        }

    }
}
